import { Actor } from '../Actor';
import { NodeCanvasRenderingContext2D } from 'canvas';

export class SolidColor extends Actor {
	constructor(private readonly color: string) {
		super();

		if (!color.startsWith('#')) {
			this.color = `#${this.color}`;
		}
	}

	_paint(_: unknown, ctx: NodeCanvasRenderingContext2D, frame: number, time: number): void {
		const { height, width } = ctx.canvas;

		ctx.fillStyle = this.color;
		ctx.fillRect(0, 0, width, height);
	}
}
